package com.jic.weamop.weBankAMOP.callback;

import lombok.extern.slf4j.Slf4j;
import org.bcos.channel.client.ChannelPushCallback;
import org.bcos.channel.dto.ChannelPush;
import org.bcos.channel.dto.ChannelResponse;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
public class PushCallback13 extends ChannelPushCallback {


    //onPush方法，在收到AMOP消息时被调用
    @Override
    public void onPush(ChannelPush push) {
        ChannelResponse response = new ChannelResponse();
        try {
            System.out.println(push.getContent());
            response.setErrorCode(0);
            response.setContent("success");
        } catch (Exception e) {
            response.setErrorCode(0);
            Map<String, String> map = new HashMap<>();
            map.put("errorCode", "9999");
            map.put("errorMsg", "system error");
            response.setContent("error");
        }
        push.sendResponse(response);
    }
}
